package com.bdsy.common.utils;

import java.util.UUID;

public class IcdnUtils {

	/**
	 * ICDN组成   
	 * 鉴定机构代码(6位)+鉴定时间(8位)+大种类(2位)+小种类(2位)+规格(长宽高各5位,共15位)+特征点(10个各16位,共160位)+顺序码(18位)+校验码(44) 
	 */
	
	//鉴定机构代码
//	private static String[] IDEN_AGEN = new String[] { "458001", "458002", "458003"};
	private static String IDEN_AGEN = "458001";
	//鉴定时间
	private static String TIME = "20180202";
	//大种类 [国画 书法 西画 古瓷 当代...]
//	private static String[] LARGE_SPECIES = new String[] { "01","02","03"};
	private static String LARGE_SPECIES = "01";
	//小种类 [默认01]
	private static String SMALL_SPECIES = "01";
	//规格 长250.00 宽 120.00  高100.00
	private static String SPECIFICATION = "2520";
	//特征点 ab1012 cd0234 fbg520 e fct101 egta01 gan52a g
//	private static String FEATURES = "ab1012cd0234fbg520efct101egta01gan52agab1012cd0234fbg520efct101egta01gan52agab1012cd0234fbg520efct101egta01gan52agab1012cd0234fbg520efct101egta01gan52agab10234f"; 
	private static String FEATURES = "ab1c";
	//顺序码
//	private static String SEQCODE = "156348789645213012";
	private static String SEQCODE = "13";
	//校验码
//	private static String CHECKCODE = "156c3487f89645cc2130h1f2e2d56gdg53dr155fg5ef";
	private static String CHECKCODE = "15c3";
	public static String getIcdn(){
		String Icdn = IDEN_AGEN+TIME+LARGE_SPECIES+SMALL_SPECIES+SPECIFICATION+FEATURES+SEQCODE+CHECKCODE;
		return Icdn;
	}
	
	//测试使用
	public static String getIcdns(){
	    //通过UUID来随机生成  
        UUID uuid = UUID.randomUUID();  
		String Icdn = uuid.toString().replace("-", "").substring(0, 32);  
		return Icdn;
	}
	
	
	public static void main(String[] args) {
		System.out.println(SPECIFICATION.length());
		System.out.println(FEATURES.length());
		System.out.println(SEQCODE.length());
		System.out.println(CHECKCODE.length());
		
		System.out.println(IcdnUtils.getIcdn());
		System.out.println(IcdnUtils.getIcdn().length());
		System.out.println(IcdnUtils.getIcdns());
	}
}
